<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="家族大会堂">

<body class="input">
<script type="text/javascript">
	$().ready( function() {	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#inputForm");
		var $tab = $("#tab");
	
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});
		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
				"familySubjectInfo.introduction": {
						required: true,
						maxlength:200
				},
				"familySubjectInfo.rightIntrodu": {
						required: true,
						maxlength:200
				},
				"familySubjectInfo.oppositionIntrodu": {
						required: true,
						maxlength:200
				}
				
			},
			messages: {
				"familySubjectInfo.introduction": {
						required: "请输入话题简介",
						maxlength: "话题简介必须在200个字符以内"
				},
				"familySubjectInfo.rightIntrodu": {
						required: "请输入正方专家介绍",
						maxlength: "正方专家介绍必须在200个字符以内"
				} ,
				"familySubjectInfo.oppositionIntrodu": {
						required: "请输入反方专家介绍",
						maxlength: "反方专家介绍必须在200个字符以内"
				}
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
		<#if actionMessages??&&(actionMessages?size > 0)>
			$.dialog({type: "success", content: "<#list actionMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 5000});
		</#if>
    
	});
	
	function checkHot(){
			 var chec = $("#isHot").attr("checked");
			 if(chec=="checked" || chec==true){
			 	$('#isHot').val('1');
			 }else{
			 	$('#isHot').val('0');
			 }
		}
	

</script>
	<div class="body">
		<div class="inputBar">
			<h1><span class="icon">&nbsp;</span><#if subjectId??>编辑家族话题<#else>新增家族话题</#if></h1>
		</div>
		<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
			<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>
		</div>		
		<form id="inputForm" class="validate" action="<#if subjectId??>${web_base}/go/family_subject!edit.htm<#else>${web_base}/go/family_subject!save.htm</#if>" method="post" enctype="multipart/form-data">
			<input type="hidden" name="familySubjectInfo.subjectId" value="${(familySubjectInfo.subjectId)!}"/>
			<table class="inputTable tabContent">
				<tr>
					<th>
						是否热门：
					</th>
					<td>
						<input type="checkbox" id="isHot" name="familySubjectInfo.isHot"  
						value="1"  <#if familySubjectInfo?? && familySubjectInfo.isHot?? && familySubjectInfo.isHot=="1">checked="checked"</#if>/>
					</td>
				</tr>
				<tr>
					<th>
						话题简介：
					</th>
					<td>
						<textarea rows="8" cols="60" name="familySubjectInfo.introduction" class="formText {required: true}" >${(familySubjectInfo.introduction)!}</textarea>
						<label id="labelUrl" class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						话题起止时间：
					</th>
					<td>
						<input type="text" id="startTime" name="familySubjectInfo.subjectBeginTime"
                    		onclick="WdatePicker({startDate:'%y',dateFmt:'yyyy-MM-dd'})"
                           value="${(familySubjectInfo.subjectBeginTime?string("yyyy-MM-dd"))!}" class="Wdate fixWidth" >
					<span>--</span>
						<input type="text" id="endTime" name="familySubjectInfo.subjectEndTime"
		                   onclick="WdatePicker({startDate:'%y',dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startTime\')}'})"
		                   value="${(familySubjectInfo.subjectEndTime?string("yyyy-MM-dd"))!}" class="Wdate fixWidth">
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						正方专家介绍：
					</th>
					<td>
						<textarea rows="8" cols="60" name="familySubjectInfo.rightIntrodu" class="formText {required: true}" >${(familySubjectInfo.rightIntrodu)!}</textarea>
					</td>
				</tr>
				<tr>
					<th>
						反方专家介绍：
					</th>
					<td>
						<textarea rows="8" cols="60" name="familySubjectInfo.oppositionIntrodu" class="formText {required: true}" >${(familySubjectInfo.oppositionIntrodu)!}</textarea>
					</td>
				</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="提  交" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
		</form>
	</div>
</body>
</@edit>